package me.zk.practice1.hw;

import java.util.*;

/**
 * @author zhangkai
 * @date 2023/8/9 16:01
 */
public class HWBJ55 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        List<List<String>> list = new ArrayList<>();

        for (int i = 1 ; i<=n; i++) {
            List<String> ans = new ArrayList<>();
            list.forEach(x->{
                x.add(0,"    ");
            });

            int first = getFirstNum(i);

            for (int j = 0; j < i; j++) {
                ans.add(getStrNum(first+j));
                if (j != i-1) {
                    ans.add("    ");
                }
            }
            if (i%2 ==0){
                Collections.reverse(ans);
            }
            list.add(ans);

        }
        for(List<String> l : list) {
            for(String s: l) {
                System.out.print(s);
            }
            System.out.println();

        }
    }



    public static String getStrNum(int num) {
        StringBuilder sb = new StringBuilder(String.valueOf(num));
        while (sb.length() < 4) {
            sb.append("*");
        }
        return sb.toString();
    }

    public static int getFirstNum(int n) {
        if (n == 1) {
            return 1;
        }
        return getFirstNum(n-1) + n-1;
    }
}
